package pers.zc.activiti.shejimoshi.guanchazhe.guanchazhe2;

/**
 * @description 观察者模式测试
 * @Author Lin FuYuan
 * @date 2020/1/6
 */
public class Test {
    public static void main(String[] args) {
        //创建主题
        ZhuTiShiXian zhuti = new ZhuTiShiXian();
        //创建三个不同的观察者
        GuanChaZheShiXian guanchazheA = new GuanChaZheShiXian("观察者A","开始");
//        GuanChaZheShiXian guanchazheB = new GuanChaZheShiXian("观察者B","开始");
//        GuanChaZheShiXian guanchazheC = new GuanChaZheShiXian("观察者C","开始");
        //将观察者注册到主题
        zhuti.addObserver(guanchazheA);
//        zhuti.addObserver(guanchazheB);
//        zhuti.addObserver(guanchazheC);

        //更新主题的数据,主题更新后,会自动通知所有已注册的观察者
        zhuti.publish();
//        zhuti.publish();
//        zhuti.publish();
//        zhuti.publish();
    }
}
